Get correct protocol when creating request. #966
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This replaces defaulting to http which is not always correct nor safe.
This feature was removed in an older commit (f69826f#diff-cf234a385fd7788d61976c078d5d093b2de418c259f1f7b3a15adb46ee1cedc3).
This commit re-implements said feature but with the standard of checking the "x-forwarded-proto" header or defaulting to "https". A standard which is already used in start-vercel:
solid-start/packages/start-vercel/entry.js
Line 58 in 925ea73
solid-start/packages/start-vercel/entry-prerender.js
Line 57 in 925ea73
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The current behavior will incorrectly default some POST requests to use the HTTP protocol when sending information. This will trigger most browsers into warning the user about an unsecure exchange of information.
This will occur when the website headers does not include an origin header.
What is the new behavior?
The new behavior tries to interpret the correct protocol (HTTP/HTTPS) from the "x-forwarded-proto" header which is the de-facto standard header for identifying the protocol.
If an origin header does not exist, the request protocol will still be correctly set to the appropriate protocol.